package com.xxgc.qinglian.qinglianserver.controller;/*
 * @Author:lsx
 * @Date:2025/6/11--06--11--15:49
 *
 */

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xxgc.qinglian.qinglianserver.controller.dto.VoteProjectDTO;
import com.xxgc.qinglian.qinglianserver.entity.ProjectEntity;
import com.xxgc.qinglian.qinglianserver.entity.ProjectEntityRepository;
import com.xxgc.qinglian.qinglianserver.result.Result;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/Voting")
@Tag(name = "排行接口")
public class VotingRankingController {

    @Autowired
    private ProjectEntityRepository  projectEntityRepository;

    @RequestMapping("/getVoteProjectList")
    public Result getRanking(@RequestBody Map map){
        String voteId = (String) map.get("voteId");
        QueryWrapper<ProjectEntity> qw = new QueryWrapper<>();
        qw.eq("vote_id", voteId);
        List<ProjectEntity> list = projectEntityRepository.list(qw);
        return Result.success(list).msg("项目投票数据");
    }
}
